﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Wicresoft.SMS.Web;
using Wicresoft.SMS.Data;
using System.Web.Mvc;
using Moq;
using Wicresoft.SMS.Web.Areas.history.Controllers;
using System.Web.Security;
using System.Reflection;



namespace SMS.Web.Test
{
    [TestClass]
    public class CustomRoleProviderTest
    {
        [TestMethod]
        public void TestMethod1()
        {
            //arrage
            //var fack_IUserRoleService = new Mock<IUserRoleService>();
            //string[] validUser = { "parkerz","i-pzhou","suek" };
            //fack_IUserRoleService.Setup(instance => instance.GetRolesForUser("parkerz")).Returns(new string[] { "GlobalAdmin" });
            //fack_IUserRoleService.Setup(instance => instance.GetRolesForUser("i-pzhou")).Returns(new string[] { "GroupAdmin" });
            //fack_IUserRoleService.Setup(instance => instance.GetRolesForUser("suek")).Returns(new string[] { "GroupUser" });
            //fack_IUserRoleService.Setup(instance => instance.GetRolesForUser(It.Is<string>(p => !validUser.Contains(p)))).Returns(new string[]{});
            //CustomRoleProvider._service = fack_IUserRoleService.Object;


            //PendingController pc = new PendingController();

            //pc.HttpContext.User = new RolePrincipal("CustomRoleProvider", new FormsIdentity(new FormsAuthenticationTicket("parkerz", false, 10000)));

            //MethodInfo method = pc.ActionInvoker.GetType().GetMethod("InvokeAuthorizationFilters");
            //var a = method.GetCustomAttributes(typeof(AuthorizeAttribute), false)[0] as IAuthorizationFilter;
            ////a.OnAuthorization(

            //pc.ActionInvoker.InvokeAction(pc.ControllerContext, "Self");

        }
    }
}
